FROM mcr.microsoft.com/dotnet/sdk:6.0  AS build
WORKDIR /src

COPY ["Admin.NET.Application/Admin.NET.Application.csproj", "Admin.NET.Application/"]
COPY ["Admin.NET.Core/Admin.NET.Core.csproj", "Admin.NET.Core/"]
COPY ["Admin.NET.Web.Core/Admin.NET.Web.Core.csproj", "Admin.NET.Web.Core/"]
COPY ["Admin.NET.Web.Entry/Admin.NET.Web.Entry.csproj", "Admin.NET.Web.Entry/"]
COPY ["nuget.config", "."]

RUN dotnet restore "Admin.NET.Web.Entry/Admin.NET.Web.Entry.csproj" --configfile "nuget.config"

COPY . .
WORKDIR "/src/Admin.NET.Web.Entry"

RUN dotnet publish "Admin.NET.Web.Entry.csproj" -c Release -o /app/publish

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS final
ENV ASPNETCORE_ENVIRONMENT Production

# 设置语言/区域设置环境变量
ENV LANG zh-Hans

# 使用阿里云的镜像源进行更新
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/' /etc/apt/sources.list

# 更新包管理器并安装free命令
RUN apt-get update && apt-get install -y procps

EXPOSE 80
WORKDIR /app
COPY --from=build /app/publish .
COPY wait-for-it.sh .
RUN chmod +x wait-for-it.sh
ENTRYPOINT ["dotnet", "Admin.NET.Web.Entry.dll"]